package cn.bdqn.controller;

import cn.bdqn.service.EmailService;
import cn.bdqn.vo.EmailDto;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EmailController {

    @RequestMapping(value = "/email")
    public void email(@RequestBody EmailDto emailDto){
        if(!"".equals(emailDto.getEmail()) && emailDto!=null){
            String content = new StringBuilder().append("恭喜你，").append(emailDto.getItemName()).append("秒杀成功，订单号是：").append(emailDto.getCode()).append("，当前订单状态：").append(emailDto.getStatus()==0?"未付款，请在30分钟内完成付款："+emailDto.getPayAddress():"已付款，等待收货").toString();
            System.out.println(content);
            //EmailService.sending(emailDto.getEmail(),"科泰商城",content);
        }
    }
}
